package com.crayon.account.fragmentspop;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.crayon.account.dao.DAOAccount;
import com.crayon.account.fragments.FragmentRGWrite;
import com.crayon.sharemenu.R;
import com.crayon.util.GDB;

public class FragmentPopBox extends FragmentPopRoot {

    public interface OnFragmentPopBoxInterface{
        public Fragment OnFragmentPopInstance();
    }



    OnFragmentPopBoxInterface onFragmentPopBoxInterface;

    public OnFragmentPopBoxInterface getOnFragmentPopBoxInterface() {
        return onFragmentPopBoxInterface;
    }

    public void setOnFragmentPopBoxInterface(OnFragmentPopBoxInterface onFragmentPopBoxInterface) {
        this.onFragmentPopBoxInterface = onFragmentPopBoxInterface;
    }

    public static FragmentPopBox newInstance(Bundle bundle) {
		FragmentPopBox f = new FragmentPopBox();
		// Supply num input as an argument.
        if(bundle!=null)
		f.setArguments(bundle);

		return f;
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		int style = DialogFragment.STYLE_NO_TITLE;
		int theme = android.R.style.Theme_Black_NoTitleBar_Fullscreen;
		theme = android.R.style.Theme_Translucent_NoTitleBar;
		setStyle(style, theme);

	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.fragment_dialog, container, false);
        if(getOnFragmentPopBoxInterface()!=null){
            FragmentTransaction ft =getChildFragmentManager().beginTransaction();
            Fragment fragment = getOnFragmentPopBoxInterface().OnFragmentPopInstance();
            if(getArguments()!=null){
                fragment.setArguments(getArguments());
            }

            ft.replace(R.id.fragment_pop_context,fragment);
            ft.commit();

        }
		return view;
	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		GDB.log(getClass(), ">>>>onActivityResult " + requestCode);
		super.onActivityResult(requestCode, resultCode, data);
	}	

}
